<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * user_agent_helper
 *
 * @author Simon Emms <simon@simonemms.com>
 */



/**
 * Is Browser
 * 
 * Runs the user_agent is_browser
 * method
 * 
 * @param string $version
 * @return bool
 */
function is_browser($version = null) {
    
    $objCI = &get_instance();
    
    $objCI->load->library('user_agent');
    
    return $objCI->user_agent->is_browser($version);
}






/**
 * Browser Version
 * 
 * Get the browser version number
 * 
 * @param bool $main_only
 * @return number
 */
function browser_version($main_only = true) {
    
    $objCI = &get_instance();
    
    $objCI->load->library('user_agent');
    
    $version = $objCI->user_agent->version();
    
    if($main_only) {
        /* Just return the main number */
        $arrVersion = explode('.', $version);
        $version = $arrVersion[0];
    }
    
    return $version;
}





function get_browser_name($no_space = true) {
    
    $objCI = &get_instance();
    
    $objCI->load->library('user_agent');
    
    $browser = $objCI->user_agent->browser();
    
    if($no_space) { $browser = preg_replace('/\s/', '-', $browser); }
    
    return $browser;
    
}

?>